package com.example.Controller;

import com.example.mapper.UserMapper;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
     UserMapper userMapper;

    @GetMapping("/findAll")
    public List<User> findAll() {
            List<User> list = userMapper.findAll();
            return list;
    }

    @GetMapping("/findId")
    public User findId(Integer id) {
        return userMapper.findId(id);
    }

    @GetMapping("/findName")
    public User findName(String name) {
        return userMapper.findName(name);
    }
}
